<template>
  <div>
	  <loading  v-if="$root.bLoading"></loading>
	  
   <Header v-if="$root.bNav"></Header>
   
     <router-view></router-view>
    <Footer v-if="$root.bFoot"></Footer>
  </div>
</template>

<script>
	import Header from "../components/header.vue"
	import Footer from "../components/footer.vue"
	import loading from '../components/loading.vue'
	
  export default {
    name:'app',
    props:{},
    data(){
      return {
        
      }
    },
	watch:{
	  $route:{
	    handler(value){
	      let path = value.path;
	      if(/home|follow|scj|column/.test(path)) this.$root.bNav = this.$root.bFoot = true;
	      if(/login|reg/.test(path)) this.$root.bNav = this.$root.bFoot = false;
	      if(/user/.test(path)) {
	        this.$root.bNav = false;
	        this.$root.bFoot = true;
	      };
		  if(/scj/.test(path)) {
		    this.$root.bNav = true;
		    this.$root.bFoot = false;
		  };
	    },
		// 第一次也要执行
	    immediate:true
	  }
	},
    components:{
		Header,Footer,loading
	},
    mounted(){},
    updated(){},
    methods:{},
    computed: {
    }
  }
</script>

<style>
  .app{}
</style>
